package com.zqx.cor.client;

import com.zqx.cor.abstracthandler.Approver;
import com.zqx.cor.request.PurchaseRequest;
import com.zqx.cor.specifichandler.*;

/**
 * descriptin: 客户端测试类
 * @author zqx
 * @date 2018/09/04
 */
public class Client {

    public static void main(String[] args) {
        Approver zx = new Director("中翔");
        Approver sf = new Manager("三丰");
        Approver zqx = new VicePresident("谦行");
        Approver zyn = new President("张玉娜");
        Approver dsh = new Congress("董事会");

        //创建职责链
        zx.setSuccessor(sf);
        sf.setSuccessor(zqx);
        zqx.setSuccessor(zyn);
        zyn.setSuccessor(dsh);

        //创建采购单
        PurchaseRequest rq1 = new PurchaseRequest(45000, 10001, "买鞋");
        zx.processRequest(rq1);
        PurchaseRequest rq2 = new PurchaseRequest(60000,10002,"买漫画");
        zx.processRequest(rq2);
        PurchaseRequest rq3 = new PurchaseRequest(160000,10003,"买化妆品");
        zx.processRequest(rq3);
        PurchaseRequest rq4 = new PurchaseRequest(800000,10004,"买海岛");
        zx.processRequest(rq4);

    }
}
